home *** CD-ROM | disk | FTP | other *** search
- Path: eua.ericsson.se!usenet
- From: euahjn@eua.ericsson.se (Henrik Johansson)
- Newsgroups: comp.lang.c++
- Subject: Re: Why use private class members instead of protected?
- Date: 12 Jan 1996 08:32:57 GMT
- Organization: Ericsson Telecom Systems Labs, Stockholm, Sweden
- Distribution: world
- Message-ID: <4d56bp$hr9@euas20.eua.ericsson.se>
- References: <30F4AB49.6ABB@sierra.net>
- Reply-To: euahjn@eua.ericsson.se
- NNTP-Posting-Host: euas31i2c37.eua.ericsson.se
- NNTP-Posting-User: euahjn
-
- In article <30F4AB49.6ABB@sierra.net>, TGColwell <snowbull@sierra.net> writes:
- > I'm relatively new to c++. I have one quick question: If child
- > classes can only access protected members of the parent class,
- > why make any members of any class private? Wouldn't it be
- > better to make members of the parent class protected so that the
- > class is alway "inheritance ready"?
- >
- > Thanks in advance,
- >
- > -Tyler
-
- I think that the widely spread style to declare every data private and write
- access methods for each has some drawbacks. I would also like to see
- some code writers use `protected:' declarations. In fact, we here at our team
- at former ELLEmTEL company, famous for its C++ standards, have designed
- a team-wide houserule subset of the style guide, that *allows* protected variables.
- Base classes do become more `inheritance ready' in this manner. OTOH,
- if the base class is designed to have its `downside' inheritance interface
- publicly accessible to users of some reusable software framework `protected:'
- is not such a good idea.
-
-
-